package com.mzy.basics.reflectionDemo.newReflection;

import java.lang.reflect.Field;
import java.lang.reflect.Type;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author mzy
 * @Date 2022/6/20 16:45
 * @Version 1.0
 */
public class GetFieldGet {
    public static void main(String[] args) throws NoSuchFieldException {
        Class<Cat> clazz = Cat.class;

        Field name = clazz.getDeclaredField("type");
        name.setAccessible(true);
        /**
         * getGenericType() 获得属性的类型，如果类型为泛型。则直接返回。
         * 否则调用getType()
         */
        Type genericType = name.getGenericType();
    }
}
